package org.example;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api-monitoring")
public class APIMonitoringController {

    @GetMapping("/api-call-count")
    public Map<String, Integer> getAPICallCounts() {
        return APIMonitoringAspect.apiCallCounts;
    }

    @GetMapping("/api-response-time")
    public Map<String, Long> getAPIResponseTime() {
        return APIMonitoringAspect.apiTotalResponseTime;
    }

    @GetMapping("/api-min-response-time")
    public Map<String, Long> getAPIMinResponseTime() {
        return APIMonitoringAspect.apiMinResponseTime;
    }

    @GetMapping("/api-max-response-time")
    public Map<String, Long> getAPIMaxResponseTime() {
        return APIMonitoringAspect.apiMaxResponseTime;
    }

    @GetMapping("/api-exception-count")
    public Map<String, Integer> getAPIExceptionCounts() {
        return APIMonitoringAspect.apiExceptionCounts;
    }
}
